home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / RIncludes / Fonts.r < prev    next >
Encoding:
Text File  |  1998-08-17  |  10.3 KB  |  314 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Fonts.r
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacOS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17.  
  18. #ifndef __FONTS_R__
  19. #define __FONTS_R__
  20.  
  21. #ifndef __CONDITIONALMACROS_R__
  22. #include "ConditionalMacros.r"
  23. #endif
  24.  
  25. #ifndef __QUICKDRAW_R__
  26. #include "Quickdraw.r"
  27. #endif
  28.  
  29. /*----------------------------fctb • Font Color Lookup Table----------------------------*/
  30. type 'fctb' as 'clut';
  31.  
  32. /*----------------------------finf • Font Family Description----------------------------*/
  33. type 'finf' {
  34.         integer = $$CountOf(Fonts);                                /* # of fonts            */
  35.         array Fonts {
  36.             integer;                                            /* Font Number            */
  37.             unsigned hex integer    plain;                        /*         Font Style        */
  38.             integer;                                            /*         Font Size        */
  39.         };
  40. };
  41. /*----------------------------FOND • Font Family Description----------------------------*/
  42. /* Note: this FOND resource definition only works when the tables at the end of the
  43.          resource are in this order:    1 - Family Character-Width Table
  44.                                          2 - Style Mapping Table
  45.                                         3 - Kerning Tables
  46. */
  47. type 'FOND' {
  48.         /* Flags Word */
  49.         boolean        proportionalFont, fixedWidthFont;
  50.         boolean        useFractWidthTable, dontUseFractWidthTable;
  51.         boolean        computeFixedPointExtra, useIntegerExtra;
  52.         boolean        useFractEnable, ignoreFractEnable;
  53.         boolean        canAdjustCharSpacing, dontAdjustCharSpacing;
  54.         unsigned hex bitstring[9] = 0;                            /* Reserved                */
  55.         boolean        noCharWidthTable, hasCharWidthTable;
  56.         boolean        noImageHeightTable, hasImageHeightTable;
  57.  
  58.         integer;                                                /* Family ID number        */
  59.     First:
  60.         integer;                                                /* first char            */
  61.     Last:
  62.         integer;                                                /* last char            */
  63.         integer;                                                /* Ascent                */
  64.         integer;                                                /* Descent                */
  65.         integer;                                                /* Leading                */
  66.         integer;                                                /* Width Max            */
  67.     WidthOffset:
  68.         unsigned hex longint = WidthTable[1] >> 3;                /* Width table offset    */
  69.     KerningOffset:
  70.         unsigned hex longint = KerningTable[1] >> 3;            /* Kerning table offset    */
  71.     StyleMapOffset:
  72.         unsigned hex longint = StyleTable[1] >> 3;                /* Style map offset        */
  73.         integer;                                                /* reserved                */
  74.         integer;                                                /* ex wid bold            */
  75.         integer;                                                /* ex wid italic        */
  76.         integer;                                                /* ex wid underline        */
  77.         integer;                                                /* ex wid outline        */
  78.         integer;                                                /* ex wid shadow        */
  79.         integer;                                                /* ex wid condensed        */
  80.         integer;                                                /* ex wid extended        */
  81.         integer;                                                /* reserved                */
  82.         longint;                                                /* reserved for intl    */
  83.     Version:
  84.         integer;                                                /* version                */
  85.  
  86.         /* Font Association Table */
  87.         integer = $$CountOf(FontEntries)-1;                     /* # of font entries    */
  88.         wide array FontEntries {
  89.             integer;                                            /* Font size            */
  90.             unsigned hex integer    plain;                        /*         Font Style        */
  91.             integer;                                            /* Resource ID of FONT    */
  92.         };
  93.         /*  */
  94.         array [$$Word(Version) == 2] {
  95.     OffsetTableStart:
  96.             integer = $$CountOf(OffsetTable) - 1;
  97.             array OffsetTable {
  98.                 longint = (BBoxStart[1] - OffsetTableStart[1]) >> 3;
  99.             };
  100.             /* Font Bounding Box Table */
  101.     BBoxStart:
  102.             integer = $$CountOf(BBoxTable) - 1;
  103.             wide array BBoxTable {
  104.                 fill bit[9];                                    /* Reserved                */
  105.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  106.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  107.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  108.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  109.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  110.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  111.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  112.                 Rect;
  113.             };
  114.         };
  115.  
  116.         /* Family Character-Width Table */
  117.         /* This outer array below handles the case when the width table offset (WidthOffset:)
  118.            is zero. */
  119.         array [$$Long(WidthOffset) != 0] {
  120.     WidthTable:
  121.             integer = $$CountOf(WidthTable) - 1;                /* # of width tables    */
  122.             wide array WidthTable {
  123.                 fill bit[9];                                    /* Reserved                */
  124.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  125.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  126.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  127.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  128.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  129.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  130.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  131.  
  132.                 wide array [$$Word(Last) - $$Word(First) + 3] {
  133.                     unsigned hex integer;                        /* Width of character    */
  134.                 };
  135.             };
  136.         };
  137.  
  138.         /* Style Mapping Table */
  139.         /* This outer array below handles the case when the width table offset (WidthOffset:)
  140.            is zero. */
  141.         array [$$Long(StyleMapOffset) != 0] {
  142.     StyleTable:
  143.             unsigned hex integer;                                /* Font class            */
  144.     CharCodeOffset:
  145.             unsigned hex longint =                                /* Encoding table offset*/
  146.                 (CharCodeTable[1,1] - StyleTable[1]) / 8 * (CharCodeTable[1,1] != 0);
  147.             fill long;                                            /* Reserved                */
  148.             array [48] {
  149.                 byte;
  150.             };
  151.             /* Style Name Table */
  152.             integer = $$CountOf(StyleNames);                    /* Number of strings    */
  153.             pstring;                                            /* Full base font name    */
  154.             array StyleNames {
  155.                 pstring;                                        /* Style suffix names    */
  156.             };
  157.  
  158.             /* Character Set Encoding Table */
  159.             /* This outer array below handles the case when the character set encoding
  160.                offset is zero (CharCodeOffset:) */
  161.             array [$$Long(CharCodeOffset[1]) != 0] {
  162.     CharCodeTable:
  163.                 integer = $$CountOf(CharacterCodes);            /* Number of entries    */
  164.                 wide array CharacterCodes {
  165.                     char;                                        /* Character code        */
  166.                     pstring;                                    /* Char name string        */
  167.                 };
  168.             };
  169.         };
  170.  
  171.         /* Kerning Tables */
  172.         /* This outer array below handles the case when the kerning table offset
  173.            (KerningOffset:) is zero. */
  174.         array [$$Long(KerningOffset) != 0] {
  175.             /* Kerning Tables */
  176.     KerningTable:
  177.             integer = $$CountOf(KerningTables) - 1;                /* Number of tables        */
  178.             wide array KerningTables {
  179.                 fill bit[9];                                    /* Reserved                */
  180.                 Boolean        noExtendedStyle, EXTENDEDstyle;        /* Extended style        */
  181.                 Boolean        noCondensedStyle, CONDENSEDstyle;    /* Condensed style        */
  182.                 Boolean        noShadowStyle, SHADOWstyle;            /* Shadow style            */
  183.                 Boolean        noOutlineStyle, OUTLINEstyle;        /* Outline style        */
  184.                 Boolean        noUnderline, UNDERLINEstyle;        /* Underline style        */
  185.                 Boolean        noItalicStyle, ITALICstyle;            /* Italic style            */
  186.                 Boolean        noBoldStyle, BOLDstyle;                /* Bold style            */
  187.                 integer = $$CountOf(KerningTableEntry);            /* # of entries            */
  188.                 wide array KerningTableEntry {
  189.                     char;                                        /* first char of pair    */
  190.                     char;                                        /* second char of pair    */
  191.                     unsigned hex integer;                        /* kerning offset        */
  192.                 };
  193.             };
  194.         };
  195. };
  196. /*----------------------------FONT • Font Description-----------------------------------*/
  197. /* PROBLEMS: the offset to the offset/width table has been changed to a longint, with the
  198.              high word stored in the neg descent field (if its not -1).  Rez can't handle
  199.              this. */
  200. type 'FONT' {
  201.         /* Font Type Flags */
  202. FontType:
  203.         boolean = 1;                                            /* Reserved                */
  204.         boolean        doExpandFont, dontExpandFont;
  205.         boolean        proportionalFont, fixedWidthFont;
  206.         boolean = 1;                                            /* Reserved                */
  207.         unsigned bitstring[2] = 0;                                /* Reserved                */
  208.         boolean        blackFont, colorFont;
  209.         boolean        notSynthetic, isSynthetic;
  210.         boolean        nofctbRsrc, hasfctbRsrc;
  211.         unsigned bitstring[3] = 0;                                /* Reserved                */
  212.         unsigned bitstring[2]    oneBit, twoBit,                    /* Font depth            */
  213.                                 fourBit, eightBit;
  214.         boolean        noCharWidthTable, hasCharWidthTable;
  215.         boolean        noImageHeightTable, hasImageHeightTable;
  216.  
  217.     FirstChar:
  218.         integer;                                                /* first char            */
  219.     LastChar:
  220.         integer;                                                /* last char            */
  221.         integer;                                                /* width max            */
  222.         integer;                                                /* kern max                */
  223.         integer;                                                /* neg descent            */
  224.         integer;                                                /* font rect width        */
  225.     Height:
  226.         integer;                                                /* font rect height        */
  227.     Offset:
  228.         unsigned integer = ((WidthTable-Offset)/16);            /* offset to off/wid tab*/
  229.         integer;                                                /* ascent                */
  230.         integer;                                                /* descent                */
  231.         integer;                                                /* leading                */
  232.     RowWords:
  233.         integer;                                                /* row width (in words)    */
  234.  
  235.         /* Tables */
  236.         /* Bit image */
  237.         hex string [($$Word(RowWords) <<($$BitField(FontType, 12, 2)
  238.             & 3) + 1) * $$Word(Height)];
  239.  
  240.         /* Location Table */
  241.         array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  242.             integer;
  243.         };
  244.  
  245.         /* Offset/Width Table */
  246.     WidthTable:
  247.         array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  248.             integer;
  249.         };
  250.  
  251.         /* Optional Character Width Table */
  252.         Array [($$Word(FontType) & 0x0002) != 0] {
  253.             array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  254.                 integer;
  255.             };
  256.         };
  257.  
  258.         /* Optional Image Height Table */
  259.         Array [($$Word(FontType) & 0x0001) != 0] {
  260.             array [$$Word(LastChar) - $$Word(FirstChar) + 3] {
  261.                 integer;
  262.             };
  263.         };
  264. };
  265. /*----------------------------FWID • Font Width Table-----------------------------------*/
  266. type 'FWID' {
  267.         unsigned hex integer;                                    /* Font type            */
  268.         integer;                                                /* first char            */
  269.         integer;                                                /* last char            */
  270.         integer;                                                /* width max            */
  271.         integer;                                                /* kern max                */
  272.         integer;                                                /* neg descent            */
  273.         integer;                                                /* font rect width        */
  274.         integer;                                                /* font rect height        */
  275.         unsigned hex integer;                                    /* offset to off/wid tab*/
  276.         integer;                                                /* ascent                */
  277.         integer;                                                /* descent                */
  278.         integer;                                                /* leading                */
  279.         integer;                                                /* row width (in words)    */
  280.         wide array {                                            /* offset/width table    */
  281.             byte;                                                /* char offset            */
  282.             byte;                                                /* char width            */
  283.         };
  284. };
  285.  
  286. /*----------------------------NFNT • Font Description-----------------------------------*/
  287. type 'NFNT' as 'FONT';
  288.  
  289. /* FRSV and resf • reserved fonts */
  290.  
  291.     type 'FRSV' {
  292.         integer = $$CountOf(ReservedFontArray);
  293.         wide array ReservedFontArray {
  294.             unsigned bitstring[9]    Chicago = 0, Geneva = 3, Monaco = 4;    // font family
  295.             unsigned bitstring[7];                                            // font size
  296.         };
  297.     };
  298.  
  299.     type 'resf' {
  300.         integer = $$CountOf(FamilyArray);
  301.         array FamilyArray {
  302.             pstring;
  303.             align word;
  304.             integer = $$CountOf(FontRecord);
  305.             array FontRecord {
  306.                 integer;                        // point size
  307.                 integer plain;                    // style
  308.             };
  309.         };
  310.     };
  311.  
  312. #endif /* __FONTS_R__ */
  313.  
  314.